home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
utilprn
/
hpdeskje.sit
/
HPDJet ƒ
/
procedures_for_PDEF5.c
< prev
next >
Wrap
Text File
|
1989-04-02
|
3KB
|
96 lines
/* 02.04.1989 amn (latest edit) */
/* procedures_for_PDEF5.c - printer driver for Macintosh and HP DeskJet, procedures */
/* common to PDEF0 and PDEF5. */
/* Authors: Ari Mujunen (amn@hutcs.hut.fi) and Olli Arnberg (oar@hutcs.hut.fi). */
/* Copyright Ari Mujunen, Olli Arnberg 1989. */
/* You may redistribute the driver (=printer resource file, source files, */
/* documentation file(s), and the file 'Copyright and Source Offer') */
/* only _non-commercially_ and _in its entirety_. */
/* See the file 'Copyright and Source Offer' and/or documentation for details. */
/* Acknowledgements: Special thanks to Mr. Earle R. Horton for his 'Daisy' */
/* daisywheel printer driver and its source code published in 'MacTutor', Nov-Dec 1987. */
/* This driver served as a basis and inspiration for our work. It also */
/* proofed that a Macintosh printer driver can be done despite the lack of */
/* documentation from Apple. */
/* Change history: */
/* Version When Who Why */
/* 2.1 02.04.1989 amn,oar Released version. */
/* Brings up manual sheet feed dialog; returns TRUE if user clicked 'OK'. */
Boolean waitNextPage(void);
/* If user presses command-., sets the low-memory global 'PrintErr' to iPrAbort. */
void checkForCommandPeriod(void);
/* Sends string to printer via low-level driver (XPrint). */
void /* ??? */ printString(StringPtr);
Boolean
waitNextPage()
{
DialogPtr sheetDialog;
WindowPtr savePort;
int itemhit, donetype;
Handle doneitem;
Rect donebox;
if ((sheetDialog = GetNewDialog(SHEETDIALOG, 0L, (WindowPtr)(-1L))) == nil)
return FALSE;
GetPort(&savePort);
InitCursor(); /* sorry, application... */
GetDItem(sheetDialog, OKBUTTON, &donetype, &doneitem, &donebox);
SetPort(sheetDialog);
PenSize(3,3);
InsetRect(&donebox, -4, -4);
FrameRoundRect(&donebox, 16, 16);
ModalDialog(0L, &itemhit);
DisposDialog(sheetDialog);
SetPort(savePort);
if (itemhit == CANCELBUTTON)
return FALSE;
return TRUE;
} /* waitNextPage */
void
checkForCommandPeriod()
{
EventRecord myEvent;
int c;
if (GetNextEvent(keyDownMask, &myEvent)) {
if (LoWord(myEvent.message & charCodeMask) == '.' &&
(myEvent.modifiers & cmdKey)) {
PrintErr = iPrAbort;
}
}
} /* checkForCommandPeriod */
void
printString(string)
StringPtr string;
{
ptXprintGlobals xPrintGlobals;
ptPrParam pXPrintParameterBlock;
xPrintGlobals = GET_XPRINT_GLOBALS;
pXPrintParameterBlock = &xPrintGlobals->xPrintParameterBlock;
pXPrintParameterBlock->csCode = iPrIOCtl;
pXPrintParameterBlock->lParam1 = (long)(string+1);
pXPrintParameterBlock->lParam2 = (long)(string[0]);
/* retCode = */ PBControl(pXPrintParameterBlock, FALSE);
}